<div id='sel-albums-images'>
  <div class="division" style="height:300px; overflow:auto;">
    <{foreach from=$img item=imgItem key=imgid}>
    <div style="margin:2px 15px;float:left">
      <input type="checkbox" name="img[]" id="c<{$imgid}>" value="<{$imgid}>" imgsrc="<{$imgid|storager:'s'}>" <{if $imgid|in_array:$selImgs}>checked<{/if}> />
      <label for="c<{$imgid}>"><img src="<{$imgid|storager:'s'}>" width="80" height="80" /></label>
    </div>
    <{/foreach}>
  </div>
  <div class='mainFoot'>
    <div class="table-action">
      <{button label=$___b2c="保存"|t:'b2c'}>
    </div>
  </div>

</div>

<script>
$E('#sel-albums-images .btn').addEvent('click',function(){
    var dialog=this.getParent('.dialog');
    var callback=dialog.retrieve('callback',$empty),checkitems=[],imgsrc=[];
    $('sel-albums-images').getElements('input').each(function(el){
        if(!!el.checked){
            checkitems.push(el.value);
            imgsrc.push(el.get('imgsrc'));
        }
    });
    callback(checkitems,imgsrc);
    dialog.retrieve('instance').close();
});
</script>
